package com.example.springboot.controller;

import com.example.springboot.common.Result;
import com.example.springboot.entity.Setting;
import com.example.springboot.mapper.SettingMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/setting")
public class SettingController {
    @Resource
    SettingMapper settingMapper;

    @GetMapping("/get")
    public Result<?> getSetting(@RequestParam("id") Integer id) {
        Setting setting = settingMapper.selectById(id);
        return Result.success(setting);
    }
    @PostMapping("/update")
    public Result<?> updateSetting(@RequestBody Setting setting) {
        settingMapper.updateById(setting);
        return Result.success();
    }
}
